package uml.model;

import java.util.*;

/**
 * 
 * @author James Feather
 * 
 */
public class ClassDataStructure_Model
		implements Collection<String>
{
	private ArrayList<String> m_stringList;

	/**
	 * Default Constructor
	 */
	public ClassDataStructure_Model ()
	{
		m_stringList = new ArrayList<String> ();
	}

	/**
	 * Constructor from a collection
	 * 
	 * @param col
	 */
	public ClassDataStructure_Model (Collection<String> col)
	{
		m_stringList = new ArrayList<String> ();
		m_stringList.addAll (col);

	}

	/**
	 * Adds a new string to the end of m_stringList
	 * 
	 * @param newString
	 */
	public void addString (String newString)
	{
		m_stringList.add (newString);
	}

	/**
	 * returns the number of newline characters.
	 * 
	 * @param index
	 * @return integer number of newline characters.
	 */
	public int getLineCount (int index)
	{
		String theString = m_stringList.get (index);
		if (theString == null)
		{
			return -1;
		}
		else
		{
			return theString.split ("\r\n|\r|\n").length;
		}

	}

	/**
	 * @return m_stringList.add()
	 */
	@Override
	public boolean add (String e)
	{
		// TODO Auto-generated method stub
		return m_stringList.add (e);
	}

	/**
	 * @return m_stringList.addAll(c)
	 */
	@Override
	public boolean addAll (Collection<? extends String> c)
	{
		// TODO Auto-generated method stub
		return m_stringList.addAll (c);
	}

	/**
	 * @return m_stringList.clear()
	 */
	@Override
	public void clear ()
	{
		// TODO Auto-generated method stub
		m_stringList.clear ();
	}

	/**
	 * @return m_stringList.contains(o)
	 */
	@Override
	public boolean contains (Object o)
	{
		// TODO Auto-generated method stub
		return m_stringList.contains (o);
	}

	/**
	 * @return m_stringList.containsAll(c)
	 */
	@Override
	public boolean containsAll (Collection<?> c)
	{
		// TODO Auto-generated method stub
		return m_stringList.containsAll (c);
	}

	/**
	 * @return m_stringList.isEmpty()
	 */
	@Override
	public boolean isEmpty ()
	{
		// TODO Auto-generated method stub
		return m_stringList.isEmpty ();
	}

	/**
	 * @return m_stringList.iterator()
	 */
	@Override
	public Iterator<String> iterator ()
	{
		// TODO Auto-generated method stub
		return m_stringList.iterator ();
	}

	/**
	 * @return m_stringList.remove(o)
	 */
	@Override
	public boolean remove (Object o)
	{
		// TODO Auto-generated method stub
		return m_stringList.remove (o);
	}

	/**
	 * @return m_stringList.removeAll()
	 */
	@Override
	public boolean removeAll (Collection<?> c)
	{
		// TODO Auto-generated method stub
		return m_stringList.removeAll (c);
	}

	/**
	 * @return m_stringList.retainAll(c)
	 */
	@Override
	public boolean retainAll (Collection<?> c)
	{
		// TODO Auto-generated method stub
		return m_stringList.retainAll (c);
	}

	/**
	 * @return m_stringList.size()
	 */
	@Override
	public int size ()
	{
		// TODO Auto-generated method stub
		return m_stringList.size ();
	}

	/**
	 * @return m_stringList.toArray()
	 */
	@Override
	public Object[] toArray ()
	{
		// TODO Auto-generated method stub
		return m_stringList.toArray ();
	}

	/**
	 * @return m_stringList.toArray(a)
	 */
	@Override
	public <T> T[] toArray (T[] a)
	{
		// TODO Auto-generated method stub
		return m_stringList.toArray (a);
	}
}
